import React from 'react';
import { withNavigation } from 'react-navigation';

import FormInput from './FormInput';

class DictInput extends React.Component {

    render() {

        const { dictKey, navigation, value, ...rest } = this.props;
        const { onChangeText } = rest;
        return (
            <FormInput
                {...rest}
                onPress={() => {
                    navigation.navigate('Dict', {
                        key: dictKey,
                        current: value.zddm,
                        callback: dict => {
                            onChangeText(dict);
                        }
                    });
                }}
                value={value.zdms}
            />
        );
    }
}

export default withNavigation(DictInput);